function C57_424_RM_CDF(Data_Summary)
%% WT 4h saline data
C5_4h_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_5') && isempty(C5_4h_RM) && ~contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_4h_RM = RM;
        C5_4h_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_5')  && ~isempty(C5_4h_RM) && ~contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_4h_RM = cat(1,C5_4h_RM,RM);
        C5_4h_Shuffle = cat(1,C5_4h_Shuffle,RM_Shuffle);
    end
end
[C54f,C54x,C54low,C54high] = ecdf(C5_4h_RM,'Function','cdf','Alpha',0.05);
[C5s4f,C5s4x,C5s4low,C5s4high] = ecdf(C5_4h_Shuffle,'Function','cdf','Alpha',0.05);

C6_4h_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_6') && isempty(C6_4h_RM) && ~contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_4h_RM = RM;
        C6_4h_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_6')  && ~isempty(C6_4h_RM) && ~contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_4h_RM = cat(1,C6_4h_RM,RM);
        C6_4h_Shuffle = cat(1,C6_4h_Shuffle,RM_Shuffle);
    end
end
[C64f,C64x,C64low,C64high] = ecdf(C6_4h_RM,'Function','cdf','Alpha',0.05);
[C6s4f,C6s4x,C6s4low,C6s4high] = ecdf(C6_4h_Shuffle,'Function','cdf','Alpha',0.05);

C7_4h_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_7') && isempty(C7_4h_RM) && ~contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_4h_RM = RM;
        C7_4h_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_7')  && ~isempty(C7_4h_RM) && ~contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_4h_RM = cat(1,C7_4h_RM,RM);
        C7_4h_Shuffle = cat(1,C7_4h_Shuffle,RM_Shuffle);
    end
end
[C74f,C74x,C74low,C74high] = ecdf(C7_4h_RM,'Function','cdf','Alpha',0.05);
[C7s4f,C7s4x,C7s4low,C7s4high] = ecdf(C7_4h_Shuffle,'Function','cdf','Alpha',0.05);

C8_4h_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_8') && isempty(C8_4h_RM) && ~contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_4h_RM = RM;
        C8_4h_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_8')  && ~isempty(C8_4h_RM) && ~contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_4h_RM = cat(1,C8_4h_RM,RM);
        C8_4h_Shuffle = cat(1,C8_4h_Shuffle,RM_Shuffle);
    end
end
[C84f,C84x,C84low,C84high] = ecdf(C8_4h_RM,'Function','cdf','Alpha',0.05);
[C8s4f,C8s4x,C8s4low,C8s4high] = ecdf(C8_4h_Shuffle,'Function','cdf','Alpha',0.05);

%% Organize data for WT saline

% get WT saline CDF mean
A = cat(1,C54f,C64f,C74f,C84f);
WT_4h_F = sort(A);
WT_4h_F = cat(1, 0, WT_4h_F, 1);

% get WT saline CDF x-steps
B = cat(1,C54x,C64x,C74x,C84x);
WT_4h_X = sort(B);
WT_4h_X = cat(1, -1, WT_4h_X, 1);

% get WT saline CDF high bound mean
C = cat(1,C54high,C64high,C74high,C84high);
WT_4h_H = sort(C);

% get WT saline CDF low bound mean
D = cat(1,C54low,C64low,C74low,C84low);
WT_4h_L = sort(D);


%% WT 24h saline data
C5_24h_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_5') && isempty(C5_24h_RM) && contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_24h_RM = RM;
        C5_24h_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_5')  && ~isempty(C5_24h_RM) && contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C5_24h_RM = cat(1,C5_24h_RM,RM);
        C5_24h_Shuffle = cat(1,C5_24h_Shuffle,RM_Shuffle);
    end
end
[C524f,C524x,C524low,C524high] = ecdf(C5_24h_RM,'Function','cdf','Alpha',0.05);
[C5s24f,C5s24x,C5s24low,C5s24high] = ecdf(C5_24h_Shuffle,'Function','cdf','Alpha',0.05);

C6_24h_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_6') && isempty(C6_24h_RM) && contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_24h_RM = RM;
        C6_24h_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_6')  && ~isempty(C6_24h_RM) && contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C6_24h_RM = cat(1,C6_24h_RM,RM);
        C6_24h_Shuffle = cat(1,C6_24h_Shuffle,RM_Shuffle);
    end
end
[C624f,C624x,C624low,C624high] = ecdf(C6_24h_RM,'Function','cdf','Alpha',0.05);
[C6s24f,C6s24x,C6s24low,C6s24high] = ecdf(C6_24h_Shuffle,'Function','cdf','Alpha',0.05);

C7_24h_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_7') && isempty(C7_24h_RM) && contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_24h_RM = RM;
        C7_24h_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_7')  && ~isempty(C7_24h_RM) && contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C7_24h_RM = cat(1,C7_24h_RM,RM);
        C7_24h_Shuffle = cat(1,C7_24h_Shuffle,RM_Shuffle);
    end
end
[C724f,C724x,C724low,C724high] = ecdf(C7_24h_RM,'Function','cdf','Alpha',0.05);
[C7s24f,C7s24x,C7s24low,C7s24high] = ecdf(C7_24h_Shuffle,'Function','cdf','Alpha',0.05);

C8_24h_RM = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'C57_8') && isempty(C8_24h_RM) && contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_24h_RM = RM;
        C8_24h_Shuffle = RM_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'C57_8')  && ~isempty(C8_24h_RM) && contains(Data_Summary(n).dateToFind, 'and')
        [RM, RM_Shuffle] = get_RM_values_ready(Data_Summary(n).Rate_Map_Corr, Data_Summary(n).Shuffled_Rate_Map_Corr_values, Data_Summary(n).RateMap_Corr_Coherent_Rot);
        C8_24h_RM = cat(1,C8_24h_RM,RM);
        C8_24h_Shuffle = cat(1,C8_24h_Shuffle,RM_Shuffle);
    end
end
[C824f,C824x,C824low,C824high] = ecdf(C8_24h_RM,'Function','cdf','Alpha',0.05);
[C8s24f,C8s24x,C8s24low,C8s24high] = ecdf(C8_24h_Shuffle,'Function','cdf','Alpha',0.05);

%% Organize data for WT 24h saline

% get WT saline CDF mean
A = cat(1,C524f,C624f,C724f,C824f);
WT_24h_F = sort(A);
WT_24h_F = cat(1, 0, WT_24h_F, 1);

% get WT saline CDF x-steps
B = cat(1,C524x,C624x,C724x,C824x);
WT_24h_X = sort(B);
WT_24h_X = cat(1, -1, WT_24h_X, 1);

% get WT saline CDF high bound mean
C = cat(1,C524high,C624high,C724high,C824high);
WT_24h_H = sort(C);

% get WT saline CDF low bound mean
D = cat(1,C524low,C624low,C724low,C824low);
WT_24h_L = sort(D);


%% Finally, put shuffle data together

% get shuffle CDF mean
A = cat(1,C5s4f,C6s4f,C7s4f,C8s4f,C5s24f,C6s24f,C7s24f,C8s24f);
Shuffle_F = sort(A);
Shuffle_F = cat(1, 0, Shuffle_F, 1);

% get shuffle CDF x-steps
B = cat(1,C5s4x,C6s4x,C7s4x,C8s4x,C5s24x,C6s24x,C7s24x,C8s24x);
Shuffle_X = sort(B);
Shuffle_X = cat(1, -1, Shuffle_X, 1);

% get shuffle CDF high bound mean
C = cat(1,C5s4high,C6s4high,C7s4high,C8s4high,C5s24high,C6s24high,C7s24high,C8s24high);
Shuffle_H = sort(C);

% get shuffle CDF low bound mean
D = cat(1,C5s4low,C6s4low,C7s4low,C8s4low,C5s24low,C6s24low,C7s24low,C8s24low);
Shuffle_L = sort(D);


%% plot all data

figure
plot(WT_4h_X,WT_4h_F,'Color','#552586','LineWidth',3);
hold on
% plot(WT_4h_X,WT_4h_L,'--k','LineWidth',1);
% hold on
% plot(WT_4h_X,WT_4h_H,'--k','LineWidth',1);
% hold on
plot(WT_24h_X,WT_24h_F,'Color','#B589D6','LineWidth',3);
hold on
% plot(WT_24h_X,WT_24h_L,'--k','LineWidth',1);
% hold on
% plot(WT_24h_X,WT_24h_H,'--k','LineWidth',1);
% hold on
plot(Shuffle_X,Shuffle_F,'-k','LineWidth',3);
hold on
% plot(Shuffle_X,Shuffle_L,'--k','LineWidth',1);
% hold on
% plot(Shuffle_X,Shuffle_H,'--k','LineWidth',1);
% hold on
% % legend('p-WT Saline','','','\alpha5-i-KO Saline','','','Shuffle','95% Confidence Interval','','Location','southeast');
xlabel('RM Correlation Value')
ylabel('Cumulative Fraction of Cells')
xlim([-0.6,1])
set(gca,'FontSize',10)
% set(gca, 'visible', 'off')
hold off

end